/*
    Author:  raghav.blacklist1
*/

#include<bits/stdc++.h>

#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define	ln(a,b)		((a==(b-1))?'\n':' ')
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define	N 			100005

using namespace std;

int pr[N];
unordered_map <ll,ll> m[N];
vector<ll> fact[N];
ll n;

ll power(ll x, unsigned ll y, ll p) 
{ 
    ll res = 1;
  
    x = x % p;
  
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x) % p; 

        y = y>>1;
        x = (x*x) % p;   
    } 
    return res; 
}

void sieve(){

	for(ll i=2;i<N;i++){

		for(ll j=i;j<N;j+=i){

			if(pr[j]){
				ll curr=j,cnt=0;
				while(curr%i==0){

					cnt++;
					curr/=i;
				}

				m[j][i]=cnt;
				pr[j]=0;
			}
		}
	}

	for(ll i=2;i<N;i++){

		for(ll j=2*i;j<N;j+=i)	fact[j].pb(i);
	}

}

ll count(ll x,ll y){

	ll ans=n/x;
	vector <ll> tmp;

	for(auto it:m[y]){

		if(m[x].count(it.F)!=0)	tmp.pb(it.F);

		else if(m[x][it.F]!=it.S)	tmp.pb(it.F); 	
	}

	rep(i,1,pow(2,tmp.size())){

		ll tmp1=1;
		ll cnt=0;

		rep(j,0,tmp.size()){

			if(i&(1<<j)){

				cnt++;
				tmp1*=tmp[j];
			}
		}

		ans+=((cnt%2?-1:1)*((n/x)/tmp1));
	}

	return ans;
}

int main(void){

	//ios::sync_with_stdio(false);
	//cin.tie(NULL);	

	cin>>n;
	rep(i,1,N)	pr[i]=1;
	sieve();
	//cout<<1<<endl;
	ll dp[n+1];
	dp[1]=0;

	ll den=power(n,hell-2,hell);
	//cout<<2<<endl;
	rep(i,2,n+1){

		ll tmp=1;
		for(auto it:fact[i]){

			tmp+=(((dp[it]*count(it,i))%hell)*den)%hell;
			tmp%=hell;
		}
		dp[i]=(tmp*n)%hell*power(n-n/i,hell-2,hell)%hell;
	}
	//cout<<3<<endl;
	ll ans=1;
	rep(i,1,n+1){

		ans+=(dp[i]*den)%hell;
		ans%=hell;
	}
	//cout<<4<<endl;
	cout<<ans<<endl;
	return 0;
}